package ch.sfug.sequence {
	import ch.sfug.sequence.ISequenceChild;		

	/**
	 * @author Administrator
	 */
	public class FunctionCall implements ISequenceChild {
		
		private var o:Object;
		private var f:String;
		private var a:Array;

		public function FunctionCall( obj:Object, func:String, ...args ) {
			o = obj;
			f = func;
			if( args != null ) setArguments( args );
		}

		public function hasToWait():Boolean {
			return false;
		}
		
		public function execute():void {
			o[ f ].apply( o, a );
		}
		
		public function stop():void {
		}
		
		public function setArguments( args:Array ):void {
			a = args;
		}
		
		public function toString():String {
			return "FunctionCall: " + o + "." + f + "( " + a.join(", ") + " );";
		}
	}
}
